'   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '           N a m e :   W X M _ D o o r L o c k B T S M 2 9 _ 1 3 . t x t                                 D a t e :   1 2   N o v   2 0 2 0 
 
 '         A u t o r :   L e o n a r d o   D E   P A L O 
 
 '         S c o p e :   T e s t   D o o r L o c k   u s i n g   s m a r t   p h o n e   B l u e   T o o t h   a n d   M O T O R   S M 2 9 
 
 '                       w i t h   M O D B U S   p r o t o c o l . 
 
 '   H a r d w a r e :   S t a n d a r d   M a s t e r . 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 O p t i o n   S p e e d   9 
 
 ' L o a d   " m e d i a \ i m a g e s \ F e e T e c h   S M 2 9 . p n g " 
 
 L o a d   " m e d i a \ i m a g e s \ K n o b B T E s t e r . j p g " 
 
 ' W a i t   S e c o n d s   1 
 
 ' B u t t o n     s o u n d \ g o n g . w a v 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   I n i t i a l i z e   S L O T S ,   B U T T O N S   a n d   K E Y S 
 
 G o s u b   S e t S l o t s 
 
 G o s u b   S e t B u t t o n s A n d K e y s 
 
 ' G o s u b   D i s a b l e A l l B u t t o n s 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   S e t   M o t o r   P a r a m e t e r s 
 
 S l o t ( S l o t _ M o d b u s B a u d R a t e )         =   2         '   0 - 9         ( 0 = 2 5 6 0 0 0   1 = 1 2 8 0 0 0   2 = 1 1 5 2 0 0 ) 
 
 S l o t ( S l o t _ M o d b u s R e t u r n D e l a y )   =   5 0 0     '   0 - 5 0 0     ( 5 0 0 ) 
 
 S l o t ( S l o t _ M i n i m u m A n g l e L i m i t )   =   0         '   0 - 4 0 9 5   ( 0 )         0 = D e s t .   f r o m   - 3 0 7 2 0   t o   + 3 0 7 2 0 
 
 S l o t ( S l o t _ M a x i m u m A n g l e L i m i t )   =   4 0 9 5   '   0 - 4 0 9 5   ( 4 0 9 5 )   0 = D e s t .   f r o m   - 3 0 7 2 0   t o   + 3 0 7 2 0 
 
 S l o t ( S l o t _ P o s i t i o n O f f s e t )         =   0         '   - 2 0 4 8   t o   + 2 0 4 7   ( 0 ) 
 
 S l o t ( S l o t _ W o r k M o d e )                     =   0         '   0 - 3   ( 0 ) 
 
 S l o t ( S l o t _ P o s i t i o n _ P )                 =   5 0       '   0 - 2 5 5   ( 3 2 ) 
 
 S l o t ( S l o t _ P o s i t i o n _ D )                 =   5 0       '   0 - 2 5 5   ( 3 2 ) 
 
 S l o t ( S l o t _ P o s i t i o n _ I )                 =   5 0       '   0 - 2 5 5   ( 0 ) 
 
 S l o t ( S l o t _ V e l o c i t y _ P )                 =   1 0       '   0 - 2 5 5   ( 1 0 ) 
 
 S l o t ( S l o t _ V e l o c i t y _ I )                 =   1 0       '   0 - 2 5 5   ( 1 0 ) 
 
 
 
 S l o t ( S l o t _ T o r q u e E n a b l e )   =   1         '   0 - 2 5 4   ( M a x = 1   o r   2 5 4   ? ) 
 
 S l o t ( S l o t _ A c c L i m i t )           =   2 5 5     '   1 - 2 5 5   ( 0   n o t   w o r k i n g ) 
 
 S l o t ( S l o t _ S p e e d L i m i t )       =   2 5 5     '   0 - 2 5 5 
 
 S l o t ( S l o t _ T o r q u e L i m i t )     =   1 0 0 0   '   0 - 1 0 0 0 
 
 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T o r q u e   p a r a m e t e r s   -   D o o r L o c k 
 
 '   D o o r L o c k   l i m i t :   1 . 5   n e w t o n / m e t e r 
 
 '   D o o r L o c k   l i m i t :   1 5 . 3   k g / c m 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T o r q u e   p a r a m e t e r s   -   M o t o r 
 
 '   M o t o r   t e s t :   6 7 9   c u r r e n t   =   3 5 2   g / 2 5 c m 
 
 '   M o t o r   t e s t :   6 7 9   c u r r e n t   =   8 . 8   k g / c m 
 
 '   M o t o r   t e s t :   6 7 9   c u r r e n t   =   0 . 8 6 3   n / m 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 C o e f f _ N M   =   0 . 0 0 1 2 7 1     ' ( 0 . 8 6 3   /   6 7 9 ) 
 
 
 
 ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T o r q u e   l i m i t s   i n   N e w t o n   M e t e r 
 
 T o r q u e F o r S t o p C W     =   0 . 7   '   V i e w   f r o m   m o t o r   s i d e   ( h u m a n   v i e w ) 
 
 T o r q u e F o r S t o p C C W   =   0 . 7 
 
 T o r q u e F o r L o g C W       =   0 . 3 5 
 
 T o r q u e F o r L o g C C W     =   0 . 3 5 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   R o t a t i o n   s o f t w a r e   l i m i t s 
 
 R m a x   =       4 0 9 5 
 
 R m i n   =         2 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   P e n   U p   /   D o w n   s e t   u p 
 
 P e n D o w n _ V a l u e     =   2 3 5 
 
 P e n U p _ V a l u e         =   3 5 0 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   L O G   F I L E   S E T   U P 
 
 V a r i a b l e   S t r i n g   F i l e H e a d e r 
 
 V a r i a b l e   S t r i n g   L o g F i l e N a m e 
 
 L o g F i l e N a m e   =   " T e s t L o g D o o r L o c k B T . t x t " 
 
 G o s u b   I n i t F i l e H e a d e r 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   L O A D   A P P S 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ H A L . e x e " 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ M O D B U S . e x e " 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ S l o t V i e w e r . e x e " 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ S i g n a l S c o p e . e x e " 
 
 L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ F i l t e r s \ T h e r e m i n o _ F i l t e r s . e x e " 
 
 ' L o a d   " T h e r e m i n o _ H A L \ T h e r e m i n o _ W a v e G e n e r a t o r . e x e " 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T E S T   M A S T E R   P R E S E N T 
 
 ' F o r   v 1   =   1   T o   9 e 9 9 
 
 ' 	 F o r   v 2   =   1   T o   2 0   '   < < <   t e s t i n g   f o r   2   s e c o n d s 
 
 ' 	 	 I f   ( S l o t ( 0 )   > =   1   A n d   S l o t ( 0 )   < =   2 )   O r   K e y ( " C T R L " ) 
 
 ' 	 	 	 E x i t   2 
 
 ' 	 	 E n d I f 
 
 ' 	 	 W a i t   S e c o n d s   0 . 1 
 
 ' 	 N e x t 
 
 ' 	 P r i n t   "   I n v a l i d   m a s t e r   n u m b e r :   "   +   S l o t ( 0 ) 
 
 ' 	 S l o t   0   =   R e c o g n i z e 
 
 ' 	 B e e p 
 
 ' N e x t 
 
 ' P r i n t   " " 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   R e s t o r e   o l d   m o t o r   p o s i t i o n s   a n d   v a r i a b l e s 
 
 G o s u b   R e s t o r e V a r s A n d P o s i t i o n s 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   M i s c e l l a n o u s   s t a r t 
 
 G o s u b   P E N   U P 
 
 ' W i n d o w   M i n S i z e 
 
 ' W a i t   S e c o n d s   1 
 
 L o a d   H i d e 
 
 G o s u b   R e d O n 
 
 ' W a i t   S e c o n d s   1 
 
 S l o t ( S l o t _ D e s t i n a t i o n )   =   4 0 9 3 
 
 G o s u b   G r e e n O n 
 
 
 
 
 
 ' < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < 
 
 S t o p 	 	 	 	 	 	   ' < < < < < < < < < < < < < <   S   T   O   P   > > > > > > > > > > > > > > > > > 
 
 ' < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     V A R I A B L E S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V a r i a b l e   N u m e r i c   S l o t _ M o d b u s S e r v e r I D         '   4 1 1   4 0 0 1 1 
 
 V a r i a b l e   N u m e r i c   S l o t _ M o d b u s B a u d R a t e         '   4 1 2   4 0 0 1 2   ( 0 - 9 ) ( 0 = 2 5 6 0 0 0   1 = 1 2 8 0 0 0   2 = 1 1 5 2 0 0 ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ M o d b u s R e t u r n D e l a y   '   4 1 3   4 0 0 1 3   ( 0 - 5 0 0 )   ( 5 0 0 ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ M i n i m u m A n g l e L i m i t   '   4 1 4   4 0 0 1 4   ( 0 = D e s t .   f r o m   - 3 0 7 2 0   t o   + 3 0 7 2 0 ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ M a x i m u m A n g l e L i m i t   '   4 1 5   4 0 0 1 5   ( 0 = D e s t .   f r o m   - 3 0 7 2 0   t o   + 3 0 7 2 0 ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ P o s i t i o n O f f s e t         '   4 1 6   4 0 0 1 6   ( - 2 0 4 8   t o   + 2 0 4 7 )   ( 0 ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ W o r k M o d e                     '   4 1 7   4 0 0 1 7   ( 0 - 3 )   ( 0 ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ P o s i t i o n _ P                 '   4 1 8   4 0 0 1 8   ( 0 - 2 5 5 )   ( 3 2 )   ( c h a n g e d   t o   5 0 ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ P o s i t i o n _ D                 '   4 1 9   4 0 0 1 9   ( 0 - 2 5 5 )   ( 3 2 )   ( c h a n g e d   t o   5 0 ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ P o s i t i o n _ I                 '   4 2 0   4 0 0 2 0   ( 0 - 2 5 5 )   ( 0 )     ( c h a n g e d   t o   5 0 ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ V e l o c i t y _ P                 '   4 2 1   4 0 0 2 1   ( 0 - 2 5 5 )   ( 1 0 ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ V e l o c i t y _ I                 '   4 2 2   4 0 0 2 2   ( 0 - 2 5 5 )   ( 1 0 ) 
 
 
 
 V a r i a b l e   N u m e r i c   S l o t _ D e s t i n a t i o n               '   4 2 9   4 0 1 2 9   ( - 3 0 7 2 0   t o   + 3 0 7 2 0 ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ T o r q u e E n a b l e             '   4 3 0   4 0 1 3 0   ( 0 - 2 5 4 )   ( M a x = 1   o r   2 5 4   ? ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ A c c L i m i t                     '   4 3 1   4 0 1 3 1   ( 1 - 2 5 5 )   ( 2 5 5 )   ( 0   n o t   w o r k i n g ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ S p e e d L i m i t                 '   4 3 2   4 0 1 3 2   ( 0 - 2 5 5 )   ( 2 5 5 ) 
 
 V a r i a b l e   N u m e r i c   S l o t _ T o r q u e L i m i t               '   4 3 3   4 0 1 3 3   ( 0 - 1 0 0 0 ) ( 1 0 0 0 ) 
 
 
 
 V a r i a b l e   N u m e r i c   S l o t _ L o c a t i o n 	 	 	 '   4 5 8   4 0 2 5 8 
 
 V a r i a b l e   N u m e r i c   S l o t _ S p e e d                       	 '   4 5 9   4 0 2 5 9 
 
 V a r i a b l e   N u m e r i c   S l o t _ M o t o r V o l t a g e             '   4 6 0   4 0 2 6 0 
 
 V a r i a b l e   N u m e r i c   s l o t _ V o l t a g e                       '   4 6 1   4 0 2 6 1 
 
 V a r i a b l e   N u m e r i c   S l o t _ T e m p e r a t u r e               '   4 6 2   4 0 2 6 2 
 
 V a r i a b l e   N u m e r i c   S l o t _ C h a n g e D i r P u l s e         '   4 6 3   4 0 2 6 3 
 
 V a r i a b l e   N u m e r i c   S l o t _ C u r r e n t                       '   4 6 4   4 0 2 6 4 
 
 
 
 V a r i a b l e   N u m e r i c   S l o t _ L e d R 
 
 V a r i a b l e   N u m e r i c   S l o t _ L e d G 
 
 V a r i a b l e   N u m e r i c   S l o t _ L e d B 
 
 
 
 V a r i a b l e   N u m e r i c   S l o t _ C u r r e n t F i l t e r e d 
 
 V a r i a b l e   N u m e r i c   S l o t _ S i g n a l S c o p e 
 
 
 
 V a r i a b l e   N u m e r i c   S l o t _ L o c a t i o n D e g r e e 
 
 V a r i a b l e   N u m e r i c   S l o t _ T o r q u e N M 
 
 
 
 V a r i a b l e   N u m e r i c   S l o t _ P E N 
 
 V a r i a b l e   N u m e r i c   S l o t _ E m e r g e n c y 
 
 
 
 V a r i a b l e   N u m e r i c   P e n D o w n _ V a l u e 
 
 V a r i a b l e   N u m e r i c   P e n U p _ V a l u e 
 
 
 
 V a r i a b l e   N u m e r i c   R m a x 
 
 V a r i a b l e   N u m e r i c   R m i n 
 
 V a r i a b l e   N u m e r i c   C o e f f _ N M 
 
 
 
 V a r i a b l e   N u m e r i c   T o r q u e F o r S t o p C W 	 	 '   V i e w   f r o m   m o t o r   s i d e   ( h u m a n   v i e w ) 
 
 V a r i a b l e   N u m e r i c   T o r q u e F o r S t o p C C W 
 
 V a r i a b l e   N u m e r i c   T o r q u e F o r L o g C W 
 
 V a r i a b l e   N u m e r i c   T o r q u e F o r L o g C C W 
 
 
 
 L a b e l   S e t S l o t s 
 
 	 S l o t _ P E N                               =       1   '   S l o t   p e n 
 
 	 
 
 	 S l o t _ L o c a t i o n                     =   4 5 8   '   G e t   L o c a t i o n 
 
 	 S l o t _ S p e e d                           =   4 5 9   '   G e t   S p e e d 
 
 	 S l o t _ M o t o r V o l t a g e             =   4 6 0   '   G e t   M o t o r   V o l t a g e 
 
 	 s l o t _ V o l t a g e                       =   4 6 1   '   G e t   V o l t a g e 
 
 	 S l o t _ T e m p e r a t u r e               =   4 6 2   '   G e t   T e m p e r a t u r e 
 
 	 S l o t _ C h a n g e D i r P u l s e         =   4 6 3   '   G e t   C h a n g e   d i r   p u l s e 
 
 	 S l o t _ C u r r e n t                       =   4 6 4   '   G e t   C u r r e n t 
 
 	 
 
 	 S l o t _ D e s t i n a t i o n               =   4 2 9     '   S e t   D e s t i n a t i o n                   0 - 4 0 9 5 
 
 	 S l o t _ T o r q u e E n a b l e             =   4 3 0     '   S e t   T o r q u e   E n a b l e               0 - 2 5 4       ( M a x = 1   o r   2 5 4   ? ) 
 
 	 S l o t _ A c c L i m i t                     =   4 3 1     '   S e t   A c c .   L i m i t                     0 - 2 5 5       ( 0   n o t   w o r k i n g   ? ) 
 
 	 S l o t _ S p e e d L i m i t                 =   4 3 2     '   S e t   S p e e d   L i m i t                   0 - 2 5 5 
 
 	 S l o t _ T o r q u e L i m i t               =   4 3 3     '   S e t   T o r q u e   L i m i t                 0 - 1 0 0 0 
 
 	 
 
 	 S l o t _ M o d b u s S e r v e r I D         =   4 1 1     '   S e t   M o d b u s   S e r v e r   I D         1 - 2 4 7 
 
 	 S l o t _ M o d b u s B a u d R a t e         =   4 1 2     '   S e t   M o d b u s   B a u d R a t e           0 - 9 
 
 	 S l o t _ M o d b u s R e t u r n D e l a y   =   4 1 3     '   S e t   M o d b u s   R e t u r n   D e l a y   0 - 5 0 0 
 
 	 S l o t _ M i n i m u m A n g l e L i m i t   =   4 1 4     '   S e t   M i n i m u m   A n g l e   L i m i t   0 - 4 0 9 5 
 
 	 S l o t _ M a x i m u m A n g l e L i m i t   =   4 1 5     '   S e t   M a x i m u m   A n g l e   L i m i t   0 - 4 0 9 5 
 
 	 S l o t _ P o s i t i o n O f f s e t         =   4 1 6     '   S e t   P o s i t i o n   O f f s e t           - 2 0 4 8   + 2 0 4 7 
 
 	 S l o t _ W o r k M o d e                     =   4 1 7     '   S e t   W o r k   M o d e                       0 - 3 
 
 	 S l o t _ P o s i t i o n _ P                 =   4 1 8     '   S e t   P o s i t i o n   P                     0 - 2 5 5   ( 3 2 ) 
 
 	 S l o t _ P o s i t i o n _ D                 =   4 1 9     '   S e t   P o s i t i o n   D                     0 - 2 5 5   ( 3 2 ) 
 
 	 S l o t _ P o s i t i o n _ I                 =   4 2 0     '   S e t   P o s i t i o n   I                     0 - 2 5 5   ( 3 2 ) 
 
 	 S l o t _ V e l o c i t y _ P                 =   4 2 1     '   S e t   V e l o c i t y   P                     0 - 2 5 5   ( 1 0 ) 
 
 	 S l o t _ V e l o c i t y _ I                 =   4 2 2     '   S e t   V e l o c i t y   I                     0 - 2 5 5   ( 1 0 ) 
 
 	 
 
 	 S l o t _ L e d R                             =   9 0 7 
 
 	 S l o t _ L e d G                             =   9 0 8 
 
 	 S l o t _ L e d B                             =   9 0 9 
 
 	 
 
 	 S l o t _ E m e r g e n c y                   =   9 1 1 
 
 	 S l o t _ C u r r e n t F i l t e r e d       =   9 1 3 
 
 	 S l o t _ S i g n a l S c o p e               =   9 1 4 
 
 	 
 
 	 S l o t _ L o c a t i o n D e g r e e         =   9 5 0 
 
 	 S l o t _ T o r q u e N M                     =   9 5 1 
 
 R e t u r n 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     B U T T O N S   A N D   K E Y S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   S e t B u t t o n s A n d K e y s 
 
 	 B u t t o n     1   T e x t     H o m e   R 
 
 	 B u t t o n     1   C o l o r   S k y B l u e 
 
 	 
 
 	 B u t t o n     3   T e x t   E n a b l e   M o t o r s 
 
 	 B u t t o n     4   T e x t   D i s a b l e   M o t o r s 
 
 	 
 
 	 B u t t o n     6   T e x t   O p e n   L o g   f i l e 
 
 	 
 
 	 B u t t o n     8   T e x t     P E N   U P 
 
 	 B u t t o n     8   C o l o r   L i g h t S t e e l B l u e 
 
 	 B u t t o n     9   T e x t     P E N   D O W N 
 
 	 B u t t o n     9   C o l o r   L i g h t S t e e l B l u e 
 
 	 B u t t o n   1 0   T e x t     P E N   S I N G L E 
 
 	 B u t t o n   1 0   C o l o r   L i g h t S t e e l B l u e 
 
 	 
 
 	 B u t t o n   1 5   T e x t     C L O S E   A L L 
 
 	 B u t t o n   1 5   C o l o r   R e d 
 
 	 
 
 	 B u t t o n   1 6   T e x t     E M E R G E N C Y 
 
 	 B u t t o n   1 6   C o l o r   R e d 
 
 	 B u t t o n   1 6   S l o t     S l o t _ E m e r g e n c y 
 
 	 
 
 	 
 
 	 B u t t o n   1 7   T e x t     R e d O n 
 
 	 B u t t o n   1 7   C o l o r   R e d 
 
 	 B u t t o n   1 8   T e x t     Y e l l o w O n 
 
 	 B u t t o n   1 8   C o l o r   Y e l l o w 
 
 	 B u t t o n   1 9   T e x t     G r e e n O n 
 
 	 B u t t o n   1 9   C o l o r   G r e e n 
 
 	 B u t t o n   2 0   T e x t     B l u O N 
 
 	 B u t t o n   2 0   C o l o r   B l u e 
 
 	 B u t t o n   2 1   T e x t     W h i t e O n 
 
 	 B u t t o n   2 1   C o l o r   W h i t e 
 
 	 B u t t o n   2 2   T e x t     R g b O f f 
 
 	 B u t t o n   2 2   C o l o r   B l a c k 
 
 	 
 
 	 ' B u t t o n   2 3   T e x t     s e t - u p   T U R N K N O B 
 
 	 ' B u t t o n   2 3   C o l o r   A q u a 
 
 	 B u t t o n   2 4   T e x t     T U R N K N O B 
 
 	 B u t t o n   2 4   C o l o r   A q u a 
 
 	 B u t t o n   2 5   T e x t     " T e m p e r a t u r e " 
 
 	 B u t t o n   2 5   C o l o r   S a l m o n 
 
 	 
 
 	 B u t t o n   2 7   T e x t     R _ 0 
 
 	 B u t t o n   2 7   C o l o r   T a n 
 
 	 B u t t o n   2 8   T e x t     R _ 9 0 
 
 	 B u t t o n   2 8   C o l o r   T a n 
 
 	 B u t t o n   2 9   T e x t     R _ 1 8 0 
 
 	 B u t t o n   2 9   C o l o r   T a n 
 
 	 B u t t o n   3 0   T e x t     R _ 2 7 0 
 
 	 B u t t o n   3 0   C o l o r   T a n 
 
 	 B u t t o n   3 1   T e x t     R _ 3 6 0 
 
 	 B u t t o n   3 1   C o l o r   T a n 
 
 	 
 
 	 B u t t o n   3 2   T e x t     R e s e t   L o g   c o u n t e r 
 
 	 B u t t o n   3 2   C o l o r   W h i t e 
 
 	 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   K E Y S 
 
 	 K e y   R i g h t 	 	 G o s u b   E x e c K e y s 
 
 	 K e y   L e f t   	 	 G o s u b   E x e c K e y s 
 
 R e t u r n 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     E M E R G E N C Y 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   E M E R G E N C Y 
 
 	 G o s u b   D i s a b l e A l l B u t t o n s 
 
 	 B u t t o n   1 5   E n a b l e d 
 
 	 B u t t o n   1 5   C o l o r   F l a s h i n g 7   Y e l l o w   R e d 
 
 	 K e y J o g _ S p e e d   =   0 
 
 	 F o r   v 1   =   1   T o   9 e 9 9 
 
 	 	 G o s u b   R e d O n 
 
 	 	 W a i t   S e c o n d s   0 . 4 
 
 	 	 G o s u b   R g b O f f 
 
 	 	 W a i t   S e c o n d s   0 . 4 
 
 	 	 L o a d   s o u n d \ A l a r m 1 0 b . w a v 
 
 	 N e x t 
 
 S t o p 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     E N A B L E / D I S A B L E   B U T T O N S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   E n a b l e A l l B u t t o n s 
 
 	 F o r   v 1   =   1   T o   3 2 
 
 	 	 B u t t o n   v 1   E n a b l e d 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   D i s a b l e A l l B u t t o n s 
 
 	 F o r   v 1   =   1   T o   3 2 
 
 	 	 B u t t o n   v 1   D i s a b l e d 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     C L O S I N G   E V E N T S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   C L O S E   A L L 
 
 	 G o s u b   S a v e V a r s A n d P o s i t i o n s 
 
 	 L o a d   C l o s e A p p s 
 
 R e t u r n 
 
 
 
 L a b e l   E v e n t S t o p 
 
 	 G o s u b   S a v e V a r s A n d P o s i t i o n s 
 
 	 G o s u b   E n a b l e A l l B u t t o n s 
 
 	 W i n d o w   S i z a b l e 
 
 	 S l o t ( S l o t _ S i g n a l S c o p e )   =   0 
 
 E n d 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     S A V E   L O A D   a n d   C L E A R   V A R S   a n d   P O S I T I O N S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   S a v e V a r s A n d P o s i t i o n s 
 
 	 v 1   =   S l o t ( S l o t _ D e s t i n a t i o n ) 
 
 	 v 2   =   N u m C y c l e 
 
 	 v 3   =   E r r o r N u m b e r 
 
 	 S a v e   V a r s 
 
 R e t u r n 
 
 
 
 L a b e l   R e s t o r e V a r s A n d P o s i t i o n s 
 
 	 L o a d   V a r s 
 
 	 I f   v 1   < >   0   A n d   v 2   < >   0   A n d   v 3   < >   0 
 
 	 	 S l o t ( S l o t _ D e s t i n a t i o n )   =   R e s e t 
 
 	 	 W a i t   S e c o n d s   0 . 0 1 
 
 	 	 S l o t ( S l o t _ D e s t i n a t i o n )   =   v 1 
 
 	 	 W a i t   S e c o n d s   0 . 0 1 
 
 	 E n d I f 
 
 	 ' 
 
 	 N u m C y c l e   =   v 2 
 
 	 E r r o r N u m b e r   =   v 3 
 
 	 ' 
 
 	 G o s u b   P r i n t V a l u e s 
 
 R e t u r n 
 
 
 
 L a b e l   C l e a r V a r s 
 
 	 N u m C y c l e   =   0 
 
 	 E r r o r N u m b e r   =   0 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '       F U N C T I O N S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 L a b e l   R _ 0 
 
 	 S l o t   ( S l o t _ D e s t i n a t i o n )   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   R _ 9 0 
 
 	 S l o t   ( S l o t _ D e s t i n a t i o n )   =   1 0 2 3 
 
 R e t u r n 
 
 
 
 L a b e l   R _ 1 8 0 
 
 	 S l o t   ( S l o t _ D e s t i n a t i o n )   =   2 0 4 7 
 
 R e t u r n 
 
 
 
 L a b e l   R _ 2 7 0 
 
 	 S l o t   ( S l o t _ D e s t i n a t i o n )   =   3 0 7 1 
 
 R e t u r n 
 
 
 
 L a b e l   R _ 3 6 0 
 
 	 S l o t   ( S l o t _ D e s t i n a t i o n )   =   4 0 9 5 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     T E S T 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V a r i a b l e   N u m e r i c   N u m C y c l e 
 
 V a r i a b l e   N u m e r i c   E r r o r N u m b e r 
 
 V a r i a b l e   N u m e r i c   E r r o r P e r c e n t a g e 
 
 V a r i a b l e   N u m e r i c   R e d F l a s h 
 
 V a r i a b l e   S t r i n g     R e s u l t 
 
 
 
 L a b e l   s e t - u p   T U R N K N O B 
 
 	 ' F o r   N u m C y c l e   =   N u m C y c l e   T o   9 e 9 9 
 
 	 S e q u e n c e F i l e N a m e   =   " S E Q U E N C E S \ S e t U p T u r n K n o b . s e q " 
 
 	 G o s u b   E x e c S e q u e n c e 
 
 	 ' N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   T U R N K N O B 
 
 	 S t a r t T i m e   =   E l a p s e d T i m e 
 
 	 C o n t r o l s   O p e n T e x t B o x 
 
 	 F o r   N u m C y c l e   =   N u m C y c l e   T o   9 e 9 9 
 
 	 	 S l o t ( S l o t _ S i g n a l S c o p e )   =   1 0 0 0 
 
 	 	 S e q u e n c e F i l e N a m e   =   " S E Q U E N C E S \ T e s t T u r n K n o b . s e q " 
 
 	 	 G o s u b   E x e c S e q u e n c e 
 
 	 	 ' P r i n t   " C y c l e   n u m b e r : "   +   N u m C y c l e   +   C R L F 
 
 	 	 G o s u b   U P D A T E _ F I L E 
 
 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   M a x   t e m p e r a t u r e   t e s t 
 
 	 	 B u t t o n   2 5   T e x t   " M o t o r T e m p :   "   +   F o r m a t ( S l o t ( S l o t _ T e m p e r a t u r e ) ,   " 0 " ) 
 
 	 	 I f   S l o t ( S l o t _ T e m p e r a t u r e )   >   5 5         ' 5 5 
 
 	 	 	 F o r   v 1   =   1   T o   3 
 
 	 	 	 	 L o a d   S o u n d \ A l a r m 1 0 b . w a v 
 
 	 	 	 	 W a i t   N o t   M e d i a P l a y i n g 
 
 	 	 	 N e x t 
 
 	 	 	 S t o p 
 
 	 	 E n d I f 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   E n a b l e   M o t o r s 
 
 	 S l o t   S l o t _ T o r q u e E n a b l e   =   1 
 
 R e t u r n 
 
 
 
 L a b e l   D i s a b l e   M o t o r s 
 
 	 S l o t   S l o t _ T o r q u e E n a b l e   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   R e s e t   L o g   c o u n t e r 
 
 	 G o s u b   C l e a r V a r s 
 
 R e t u r n 
 
 
 
 L a b e l   T E S T   P A S S E D 
 
 	 G o s u b   G r e e n O n 
 
 	 R e s u l t   =   "   - P A S S -   " 
 
 	 G o s u b   U P D A T E _ F I L E 
 
 R e t u r n 
 
 
 
 L a b e l   T E S T   F A I L 
 
 	 G o s u b   R e d O n 
 
 	 ' G o s u b   S a v e R e c o r d 
 
 	 L o a d   S o u n d \ D o o r B e l l . w a v 
 
 	 E r r o r N u m b e r   =   E r r o r N u m b e r   +   1 
 
 	 E r r o r P e r c e n t a g e   =   ( 1 0 0   *   E r r o r N u m b e r )   /   N u m C y c l e 
 
 	 R e s u l t   =   "   - F A I L -   "   +   " N u m   E r r : "   +   F o r m a t ( E r r o r N u m b e r ,   " 0 0 0 " )   +   "       % = "   +   F o r m a t ( E r r o r P e r c e n t a g e ,   " 0 0 . 0 0 " ) 
 
 	 G o s u b   U P D A T E _ F I L E 
 
 	 P r i n t   R e s u l t 
 
 	 G o s u b   R E D   A L A R M 
 
 R e t u r n 
 
 
 
 
 
 L a b e l   R E D   A L A R M 
 
 	 L o a d   S o u n d \ A l a r m _ 2 _ t i m e s . w a v 	 	 ' < < < < < < < < < < < < < < < < 
 
 	 F o r   R e d F l a s h   =   1   T o   5 
 
 	 	 G o s u b   R g b O f f 
 
 	 	 W a i t   S e c o n d s   0 . 2 
 
 	 	 G o s u b   R e d O n 
 
 	 	 W a i t   S e c o n d s   0 . 1 5 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     P E N   U P / D O W N 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   P E N   U P 
 
 	 S l o t ( S l o t _ P E N )   =   P e n U p _ V a l u e 
 
 	 W a i t   S e c o n d s   0 . 1 
 
 R e t u r n 
 
 
 
 L a b e l   P E N   D O W N 
 
 	 S l o t ( S l o t _ P E N )   =   P e n D o w n _ V a l u e 
 
 	 W a i t   S e c o n d s   0 . 1 
 
 R e t u r n 
 
 
 
 L a b e l   P E N   S I N G L E 
 
 	 G o s u b   P E N   D O W N 
 
 	 W a i t   S e c o n d s   0 . 3 5 
 
 	 G o s u b   P E N   U P 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     L E D   C O L O R S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   R e d O n 
 
 	 S l o t   S l o t _ L e d R   =   8 0 0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   G r e e n O n 
 
 	 S l o t   S l o t _ L e d R   =   0 
 
 	 S l o t   S l o t _ L e d G   =   8 0 0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   B l u O N 
 
 	 S l o t   S l o t _ L e d R   =   0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   8 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   Y e l l o w O n 
 
 	 S l o t   S l o t _ L e d R   =   8 0 0 
 
 	 S l o t   S l o t _ L e d G   =   4 0 0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   W h i t e O n 
 
 	 S l o t   S l o t _ L e d R   =   8 0 0 
 
 	 S l o t   S l o t _ L e d G   =   8 0 0 
 
 	 S l o t   S l o t _ L e d B   =   8 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   R g b O f f 
 
 	 S l o t   S l o t _ L e d R   =   0 
 
 	 S l o t   S l o t _ L e d G   =   0 
 
 	 S l o t   S l o t _ L e d B   =   0 
 
 R e t u r n 
 
 
 
 L a b e l   W h i t e F r o n t O n 
 
 	 ' S l o t   S l o t _ W h i t e F r o n t   =   1 0 0 0 
 
 	 G o s u b   W h i t e O n 
 
 R e t u r n 
 
 
 
 L a b e l   W h i t e F r o n t O F F 
 
 	 ' S l o t   S l o t _ W h i t e F r o n t   =   0 
 
 	 G o s u b   R g b O f f 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     S E Q U E N C E   L O A D I N G   A N D   E X E C U T I O N 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V a r i a b l e   S t r i n g   S e q u e n c e F i l e N a m e 
 
 V a r i a b l e   S t r i n g   S e q u e n c e 
 
 V a r i a b l e   S t r i n g   S e q u e n c e C m d 
 
 V a r i a b l e   N u m e r i c   S e q u e n c e I n d e x 
 
 V a r i a b l e   N u m e r i c   S e q u e n c e L e n g t h 
 
 
 
 L a b e l   E x e c S e q u e n c e 
 
 	 L o a d   S e q u e n c e   S e q u e n c e F i l e N a m e 
 
 	 I f   L e n ( S e q u e n c e )   =   0 
 
 	 	 C o n t r o l s   O p e n T e x t B o x 
 
 	 	 P r i n t   C R L F   +   "   S e q u e n c e   f i l e   n o t   f o u n d :   "   +   S e q u e n c e F i l e N a m e 
 
 	 	 B e e p 
 
 	 	 S t o p 
 
 	 E n d I f 
 
 	 '   S e l e c t 
 
 	 V a r i a b l e   N u m e r i c   E x e c S e q u e n c e S t a r t T i m e 
 
 	 E x e c S e q u e n c e S t a r t T i m e   =   E l a p s e d T i m e 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 	 S e q u e n c e L e n g t h   =   G e t S e p a r a t e d S t r i n g C o u n t ( S e q u e n c e ,   C R L F ) 
 
 	 F o r   S e q u e n c e I n d e x   =   0   T o   S e q u e n c e L e n g t h - 1 
 
 	 	 S e q u e n c e C m d   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e ,   S e q u e n c e I n d e x ,   C R L F ) 
 
 	 	 S e q u e n c e C m d   =   R e p l a c e ( S e q u e n c e C m d ,   C h r ( 9 ) ,   "   " )   ' T A B S   t o   S P A C E S 
 
 	 	 S e q u e n c e C m d   =   R e m o v e C o m m e n t s ( S e q u e n c e C m d ) 
 
 	 	 S e q u e n c e C m d   =   T r i m ( S e q u e n c e C m d ) 
 
 	 	 ' 
 
 	 	 I f   S e q u e n c e C m d   < >   " " 
 
 	 	 	 ' P r i n t   "   E x e c u t i n g   c o m m a n d :   "   +   S e q u e n c e C m d   +   C R L F 
 
 	 	 ' 
 
 	 	 	 S e l e c t   L C a s e ( S e q u e n c e C m d ) 
 
                         '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   E n d   s e q u e n c e 
 
 	 	 	 	 C a s e   " e n d s e q " 
 
 	 	 	 	 	 S e q u e n c e I n d e x   =   S e q u e n c e L e n g t h - 1 
 
 	 	         '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   A C T I O N S 
 
 	 	 	 	 C a s e   " e n a b l e m o t o r s "           '   e n a b l e   m o v e m e n t   m o t o r s 
 
 	 	 	 	 	 G o s u b   E n a b l e   M o t o r s 
 
 	 	 	 	 C a s e   " d i s a b l e m o t o r s "         '   d i s a b l e   m o v e m e n t   m o t o r s 
 
 	 	 	 	 	 G o s u b   D i s a b l e   M o t o r s 
 
 	 	 	 	 C a s e   " w a i t a l l m o t o r s " 
 
 	 	 	 	 	 G o s u b   W a i t A l l M o t o r s 
 
 	 	 	 	 C a s e   " C L O S E   A L L " 
 
 	 	 	 	 	 G o s u b   C L O S E   A L L 
 
 	 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   H O M I N G 
 
 	 	 	 	 C a s e   " h o m e _ r " 
 
 	 	 	 	 	 G o s u b   H o m e   R 
 
 	 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   L E D   C O L O R S 
 
 	 	 	 	 C a s e   " r e d o n " 
 
 	 	 	 	 	 G o s u b   R e d O n 
 
 	 	 	 	 C a s e   " g r e e n o n " 
 
 	 	 	 	 	 G o s u b   G r e e n O n 
 
 	 	 	 	 C a s e   " b l u o n " 
 
 	 	 	 	 	 G o s u b   B l u O N 
 
 	 	 	 	 C a s e   " y e l l o w o n " 
 
 	 	 	 	 	 G o s u b   Y e l l o w O n 
 
 	 	 	 	 C a s e   " w h i t e o n " 
 
 	 	 	 	 	 G o s u b   W h i t e O n 
 
 	 	 	 	 C a s e   " r g b o f f " 
 
 	 	 	 	 	 G o s u b   R g b O f f 
 
 	 	 	 	 C a s e   " w h i t e f r o n t o n " 
 
 	 	 	 	 	 G o s u b   W h i t e F r o n t O n 
 
 	 	 	 	 C a s e   " w h i t e f r o n t o f f " 
 
 	 	 	 	 	 G o s u b   W h i t e F r o n t O F F 
 
 	 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   P e n   a c t i o n s 
 
 	 	 	 	 C a s e   " p e n u p "                         '   m o v e   p e n   u p 
 
 	 	 	 	 	 G o s u b   P E N   U P 
 
 	 	 	 	 C a s e   " p e n d o w n "                     '   m o v e   p e n   d o w n 
 
 	 	 	 	 	 G o s u b   P E N   D O W N 
 
 	 	 	 	 C a s e   " p e n s i n g l e "                 '   s i n g l e   c l i c k 
 
 	 	 	 	 	 G o s u b   P E N   S I N G L E 
 
 	 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   W i t h   p a r a m e t e r s 
 
 	 	 	 	 C a s e E l s e 
 
 	 	 	 	 	 s 1   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   0 ) 
 
 	 	 	 	 	 S e l e c t   L C a s e ( s 1 ) 
 
 	 	 	 	 	 	 C a s e   " m o v e _ r " 
 
 	 	 	 	 	 	 	 S l o t ( S l o t _ D e s t i n a t i o n )   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 	 G o s u b   W a i t A l l M o t o r s 
 
 	 	 	 	 	 	 C a s e   " p a u s e " 
 
 	 	 	 	 	 	 	 W a i t   S e c o n d s   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 C a s e   " s i g n a l s c o p e " 
 
 	 	 	 	 	 	 	 S l o t ( S l o t _ S i g n a l S c o p e )   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 C a s e   " t o r q u e f o r s t o p c w " 
 
 	 	 	 	 	 	 	 T o r q u e F o r S t o p C W   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 C a s e   " t o r q u e f o r s t o p c c w " 
 
 	 	 	 	 	 	 	 T o r q u e F o r S t o p C C W   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 C a s e   " t o r q u e f o r l o g c w " 
 
 	 	 	 	 	 	 	 T o r q u e F o r L o g C W   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 C a s e   " t o r q u e f o r l o g c c w " 
 
 	 	 	 	 	 	 	 T o r q u e F o r L o g C C W   =   G e t S e p a r a t e d S t r i n g ( S e q u e n c e C m d ,   1 ) 
 
 	 	 	 	 	 	 C a s e E l s e 
 
 	 	 	 	 	 	 	 I f   s 1   < >   " " 
 
 	 	 	 	 	 	 	 	 C o n t r o l s   O p e n T e x t B o x 
 
 	 	 	 	 	 	 	 	 P r i n t   C R L F   +   "   U n r e c o g n i z e d   c o m m a n d :   "   +   S e q u e n c e C m d   +   C R L F 
 
 	 	 	 	 	 	 	 	 B e e p 
 
 	 	 	 	 	 	 	 	 S t o p 
 
 	 	 	 	 	 	 	 E n d I f 
 
 	 	 	 	 	 E n d S e l e c t 
 
 	 	 	 E n d S e l e c t 
 
 	 	 E n d I f 
 
 	 N e x t 
 
 	 S e q u e n c e F i l e N a m e   =   R e p l a c e ( S e q u e n c e F i l e N a m e , " . s e q " , " " ) 
 
 	 ' P r i n t   S e q u e n c e F i l e N a m e   +   "   e x e c u t e d   i n   "   +   F o r m a t ( E l a p s e d T i m e   -   E x e c S e q u e n c e S t a r t T i m e ,   " 0 . 0 0 " )   +   "   s e c o n d s "   +   C R L F 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     H O M E     R 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   H o m e   R 
 
 	 S l o t ( S l o t _ D e s t i n a t i o n )   =   4 0 9 5 
 
 	 ' G o s u b   P r i n t V a l u e s 
 
 	 B u t t o n   6   C o l o r   S k y B l u e 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     J O G   w i t h   k e y b o a r d 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   E x e c K e y s 
 
 	 V a r i a b l e   N u m e r i c   K e y J o g _ S p e e d 
 
 	 V a r i a b l e   N u m e r i c   J o g S p e e d 
 
 	 J o g S p e e d   =   K e y J o g _ S p e e d   /   1 0 0 
 
 	 S e l e c t   T r u e 
 
 	 	 C a s e   K e y ( " S H I F T " ) 
 
 	 	 	 J o g S p e e d   =   J o g S p e e d   *   0 . 1 
 
 	 	 C a s e   K e y ( " C T R L " ) 
 
 	 	 	 J o g S p e e d   =   J o g S p e e d   *   0 . 0 1 
 
 	 	 C a s e   K e y ( " A L T " ) 
 
 	 	 	 J o g S p e e d   =   J o g S p e e d   *   0 . 0 0 1 
 
 	 E n d S e l e c t 
 
 	 ' 
 
 	 I f   K e y ( " R i g h t " ) 
 
 	 	 S l o t   S l o t _ D e s t i n a t i o n   =   L i m i t ( S l o t ( S l o t _ D e s t i n a t i o n )   +   J o g S p e e d ,   R m i n ,   R m a x ) 
 
 	 E n d I f 
 
 	 I f   K e y ( " L e f t " ) 
 
 	 	 S l o t   S l o t _ D e s t i n a t i o n   =   L i m i t ( S l o t ( S l o t _ D e s t i n a t i o n )   -   J o g S p e e d ,   R m i n ,   R m a x ) 
 
 	 E n d I f 
 
 	 
 
 	 G o s u b   P r i n t V a l u e s 
 
 R e t u r n 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     P R I N T   V A L U E S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   P r i n t V a l u e s 
 
 	 ' s 1   =               " R = "   +   F o r m a t ( S l o t ( S l o t _ D e s t i n a t i o n ) ,   " 0 . 0 0 0 " ) 
 
 	 ' P r i n t   C R L F   +   s 1 
 
 R e t u r n 
 
 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '       W a i t   u n t i l   a l l   t h e   M o t o r s   a r e   s t o p p e d 
 
 ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V a r i a b l e   N u m e r i c   W a i t M o t 1 
 
 L a b e l   W a i t A l l M o t o r s 
 
 	 W a i t   S e c o n d s   0 . 1   '   < < <   e n s u r e s   t h a t   m o t o r s   a r e   r e a l l y   s t a r t e d 
 
 	 F o r   W a i t M o t 1   =   1   T o   9 e 9 9 
 
 	 	 I f   A b s ( S l o t ( S l o t _ L o c a t i o n )   -   S l o t ( S l o t _ D e s t i n a t i o n ) )   <   1 5 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 0 0 5 
 
 	 	 G o s u b   T o r q u e T e s t 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '       T o r q u e   T e s t 
 
 ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 V a r i a b l e   N u m e r i c   T r i g L e v e l T o r q u e 
 
 V a r i a b l e   N u m e r i c   T r i g S t o p T o r q u e 
 
 V a r i a b l e   N u m e r i c   T o r q u e N M 
 
 V a r i a b l e   S t r i n g   D i r e c t i o n 
 
 L a b e l   T o r q u e T e s t 
 
 	 T o r q u e N M   =   C o e f f _ N M   *   S l o t ( S l o t _ C u r r e n t F i l t e r e d ) 
 
 	 ' 
 
 	 S l o t   ( S l o t _ T o r q u e N M )   =   T o r q u e N M 
 
 	 S l o t   ( S l o t _ L o c a t i o n D e g r e e )   =   S l o t ( S l o t _ L o c a t i o n )   *   3 6 0   /   4 0 9 6 
 
 	 ' 
 
 	 I f   S l o t ( S l o t _ S p e e d )   >   0 
 
 	 	 D i r e c t i o n   =   "   C W :   " 
 
 	 	 T r i g L e v e l T o r q u e   =   T o r q u e F o r L o g C W 
 
 	 	 T r i g S t o p T o r q u e   =   T o r q u e F o r S t o p C W 
 
 	 	 
 
 	 E l s e 
 
 	 	 D i r e c t i o n   =   " C C W :   " 
 
 	 	 T r i g L e v e l T o r q u e   =   T o r q u e F o r L o g C C W 
 
 	 	 T r i g S t o p T o r q u e   =   T o r q u e F o r S t o p C C W 
 
 	 E n d I f 
 
 	 ' 
 
 	 I f   T o r q u e N M   >   T r i g L e v e l T o r q u e 
 
 	 	 G o s u b   P r i n t L o g P a r a m e t e r s 
 
 	 E n d I f 
 
 	 I f   T o r q u e N M   >   T r i g S t o p T o r q u e 
 
 	 	 G o s u b   P r i n t S t o p P a r a m e t e r s 
 
 	 	 G o s u b   S t o p M o t o r 
 
 	 	 G o s u b   R e d O n 
 
 	 	 S t o p 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '       S T O P   M O T O R 
 
 ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   S t o p M o t o r 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 	 '     D O   N O T   C H A N G E   D E L A Y S   A N D   I N S T R U C T I O N S 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 	 S l o t ( S l o t _ T o r q u e L i m i t )   =   1 
 
 	 S l o t ( S l o t _ D e s t i n a t i o n )   =   S l o t ( S l o t _ L o c a t i o n ) 
 
 	 W a i t   S e c o n d s   1 
 
 	 S l o t ( S l o t _ D e s t i n a t i o n )   =   S l o t ( S l o t _ L o c a t i o n ) 
 
 	 S l o t ( S l o t _ T o r q u e L i m i t )   =   1 0 
 
 	 W a i t   S e c o n d s   0 . 1 
 
 	 S l o t ( S l o t _ T o r q u e L i m i t )   =   1 0 0 0 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 	 S l o t ( S l o t _ S i g n a l S c o p e )     =   0 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '       P R I N T   L O G 
 
 ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   P r i n t S t o p P a r a m e t e r s 
 
 	 C o n t r o l s   O p e n T e x t B o x 
 
 	 P r i n t   "   - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   S T O P   L I M I T   R E A C H E D   - -   "   +   C R L F 
 
 	 G o s u b   P r i n t L o g P a r a m e t e r s 
 
 R e t u r n 
 
 
 
 L a b e l   P r i n t L o g P a r a m e t e r s 
 
 	 C o n t r o l s   O p e n T e x t B o x 
 
 	 L o g L i n e   =   P a d L e f t ( F o r m a t ( N u m C y c l e ) ,   7 ) 
 
 	 L o g L i n e   =   L o g L i n e   +   "     "   +   D i r e c t i o n   +   F o r m a t ( S l o t ( S l o t _ L o c a t i o n D e g r e e ) ,   " 0 0 0 " ) 
 
 	 L o g L i n e   =   L o g L i n e   +   "       "   +   F o r m a t ( T r i g L e v e l T o r q u e ,   " 0 . 0 0 0 " ) 
 
 	 L o g L i n e   =   L o g L i n e   +   "     "   +   F o r m a t ( T o r q u e N M ,   " 0 . 0 0 0 " ) 
 
 	 L o g L i n e   =   L o g L i n e   +   "       "   +   F o r m a t ( T r i g S t o p T o r q u e ,   " 0 . 0 0 0 " ) 
 
 	 L o g L i n e   =   L o g L i n e   +   "     "   +   F o r m a t ( T o r q u e N M ,   " 0 . 0 0 0 " ) 
 
 	 P r i n t   L o g L i n e   +     C R L F 
 
 	 G o s u b   U P D A T E _ F I L E 
 
 R e t u r n 
 
 
 
 L a b e l   I n i t F i l e H e a d e r 
 
 	 F i l e H e a d e r   =   C R L F 
 
 	 F i l e H e a d e r   =   F i l e H e a d e r   +   "                                                                                             N . m         N . m         N . m .       N . m .     "   +   C R L F 
 
 	 F i l e H e a d e r   =   F i l e H e a d e r   +   "                                                                                           T R I G G .                 T R I G G .                 "   +   C R L F 
 
 	 F i l e H e a d e r   =   F i l e H e a d e r   +   "                                           E X E C                   D I R E C T I O N     L E V E L     A C T U A L     S T O P     A C T U A L   "   +   C R L F 
 
 	 F i l e H e a d e r   =   F i l e H e a d e r   +   "       D A T E           H H / M M / S S   T I M E     C Y C L E         A N G L E         T O R Q U E   T O R Q U E   T O R Q U E   T O R Q U E   "   +   C R L F 
 
 	 F i l e H e a d e r   =   F i l e H e a d e r   +   " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "   +   C R L F 
 
 	 S a v e   S t r i n g T o F i l e   F i l e H e a d e r   L o g F i l e N a m e 
 
 R e t u r n 
 
 
 
 L a b e l   O p e n   L o g   f i l e 
 
 	 L o a d   " F i l e s \ "   +   L o g F i l e N a m e 
 
 R e t u r n 
 
 
 
 V a r i a b l e   S t r i n g   L o g L i n e 
 
 V a r i a b l e   N u m e r i c   S t a r t T i m e 
 
 L a b e l   U P D A T E _ F I L E 
 
 	 s 1   =   " " 
 
 	 s 1   =   F o r m a t ( N o w ,   " d d / M M M / y y y y   H H : m m : s s " ) 
 
 	 s 1   =   s 1   +   "   "   +   F o r m a t ( E l a p s e d T i m e   -   S t a r t T i m e ,   " 0 . 0 0 " ) 
 
 	 s 1   =   s 1   +   L o g L i n e 
 
 	 S a v e   S t r i n g T o F i l e   s 1   L o g F i l e N a m e 
 
 	 S t a r t T i m e   =   E l a p s e d T i m e 
 
 R e t u r n 
 
 
 
 
 
 ' E X E C   D e s t X   =   1 2 
 
 